<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <div class="content">
        <div class="panel panel-default panel-intro">

            <div class="panel-body">
                <div id="myTabContent" class="tab-content">
                    <div class="tab-pane fade active in" id="one">
                        <div class="widget-body no-padding">

                            <div class="bootstrap-table">
                                <div class="commonsearch-table ">
                                    <fieldset>
                                        <div class="row">

                                            <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">
                                                <label for="createtime" class="control-label col-xs-4">录单时间</label>
                                                <div class="col-xs-8">
                                                    <input type="text" class="form-control datetimepicker" name="createtime" value="{:date('Y-m-d H:i:s',$row.createtime)}" placeholder="录单时间" id="createtime" data-index="2" disabled>
                                                </div>
                                            </div>
                                            <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">
                                                <label for="collectiontime" class="control-label col-xs-4">收款期间</label>
                                                <div class="col-xs-8">
                                                    <input type="text" class="form-control datetimepicker" name="collectiontime" value="{:date('Y-m-d H:i:s',time())}" placeholder="录单时间" id="collectiontime" data-index="2" disabled>
                                                </div>
                                            </div>

                                            <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">
                                                <label for="c-storehouse_id" class="control-label col-xs-4">出库仓库</label>
                                                <div class="col-xs-8">
                                                    <input id="c-storehouse_id" data-rule="required" data-source="data/storehouse/index" data-field="name" class="form-control selectpage" name="storehouse_id" type="text" value="{$row.storehouse_id}" disabled>
                                                </div>
                                            </div>
                                            <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">
                                                <label for="c-customer_id" class="control-label col-xs-4">客户</label>
                                                <div class="col-xs-8">
                                                    <input id="c-customer_id" data-rule="required" data-source="customer/customer/index" data-field="company" class="form-control selectpage" name="customer_id" type="text" value="{$row.customer_id}" disabled>
                                                </div>
                                            </div>
                                            <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">
                                                <label for="company" class="control-label col-xs-4">税点</label>
                                                <div class="col-xs-8">
                                                    <input type="text" class="form-control " name="tax" value="{$row.tax}" placeholder="税点" id="shuifei" data-index="7" onkeyup="checkTaxFloat(this);" disabled>
                                                </div>
                                            </div>
                                            <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">
                                                <label for="operator" class="control-label col-xs-4">经手人</label>
                                                <div class="col-xs-8">
                                                    <input type="text" class="form-control" name="operator"  placeholder="经手人" id="operator" data-index="6" value="{$admin['nickname']}" disabled>
                                                </div>
                                            </div>
                                            <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">
                                                <label for="company" class="control-label col-xs-4">部门单位</label>
                                                <div class="col-xs-8">
                                                    <input type="text" class="form-control" name="company"  placeholder="部门单位" id="company" data-index="7" value="{$row.company}" disabled>
                                                </div>
                                            </div>
                                            <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">
                                                <label for="explain" class="control-label col-xs-4">说明</label><div class="col-xs-8">
                                                <input type="text" class="form-control" name="explain" value="{$row.explain}" placeholder="说明" id="explain" data-index="13" disabled>
                                            </div>


                                            </div>
                                        <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">
                                            <label for="abstract" class="control-label col-xs-4">运费</label>
                                            <div class="col-xs-8">
                                                <input type="text" class="form-control" name="abstract" value="{$row.allfare}" placeholder="运费" id="abstract" data-index="14" disabled>
                                            </div>
                                            <br>
                                        </div>
                                </div>
                                </fieldset>
                            </div>
                        </div>

                        </div><div class="columns-right pull-right" style="margin-top:10px;margin-bottom:10px;">
                        </div>
                            <table id="table" class="table table-striped table-bordered table-hover table-nowrap"  data-operate-edit="1" data-operate-del="1" width="100%">
                                <thead>
                                <tr>
                                    <th style="text-align: center; vertical-align: middle; " data-field="id"><div class="th-inner ">Id</div></th>
                                    <th style="text-align: center; vertical-align: middle; " ><div class="th-inner ">商品编号</div></th>
                                    <th style="text-align: center; vertical-align: middle; " data-field="number"><div class="th-inner ">商品名称</div></th>
<!--                                    <th style="text-align: center; vertical-align: middle; " data-field="status"><div class="th-inner ">产地</div></th>-->
                                    <th style="text-align: center; vertical-align: middle; " data-field="supplier_id"><div class="th-inner ">规格</div></th>
                                    <th style="text-align: center; vertical-align: middle; " data-field="operator"><div class="th-inner ">账面库存</div></th>
                                    <th style="text-align: center; vertical-align: middle; " data-field="company"><div class="th-inner ">虚拟库存</div></th>
                                    <th style="text-align: center; vertical-align: middle; " data-field="order_goods_total"><div class="th-inner ">退货数量</div><div class="fht-cell"></div></th>
                                    <th style="text-align: center; vertical-align: middle; " data-field="arrival_total"><div class="th-inner ">销售单位</div><div class="fht-cell"></div></th>
                                    <th style="text-align: center; vertical-align: middle; " data-field="order_price"><div class="th-inner ">销售单价</div><div class="fht-cell"></div></th>
                                    <th style="text-align: center; vertical-align: middle; " data-field="order_price"><div class="th-inner ">销售金额</div><div class="fht-cell"></div></th>
                                    <th style="text-align: center; vertical-align: middle; " data-field="arrival_price"><div class="th-inner ">税点</div><div class="fht-cell"></div></th>
                                    <th style="text-align: center; vertical-align: middle; " data-field="paid_in_price"><div class="th-inner ">含税单价</div><div class="fht-cell"></div></th>
                                    {if condition="$is_finance == 1"}
                                    <th style="text-align: center; vertical-align: middle; " ><div class="th-inner ">成本价格</div><div class="fht-cell"></div></th>
                                    {else /}
                                    {/if}
                                    <th style="text-align: center; vertical-align: middle; " data-field="paid_in_price"><div class="th-inner ">税额</div><div class="fht-cell"></div></th>
                                    <th style="text-align: center; vertical-align: middle; " data-field="explain"><div class="th-inner ">合计</div><div class="fht-cell"></div></th>
                                    <th style="text-align: center; vertical-align: middle; " data-field="operate"><div class="th-inner ">备注</div><div class="fht-cell"></div></th>
                                </tr>
                                </thead>
                                <tbody data-listidx="0" class="connnn">
                                    {volist name="list" id="vo"}
                                    {if condition="$vo['goods_type'] == 1"}
                                            <tr data-index="0">
                                                <td style="text-align: center; vertical-align: middle; ">
                                                    <input name="row[{$vo.id}][goods_id]" value="{$vo.id}" style="display: none" class="gid gids{$vo.id}">{$vo.id}</td>
                                                <td style="text-align: center; vertical-align: middle; ">{$vo.number}</td>
                                                <td style="text-align: center; vertical-align: middle; " class="title">{$vo.title}</td>
<!--                                                <td style="text-align: center; vertical-align: middle; ">{$vo.place_origin}</td>-->
                                                <td style="text-align: center; vertical-align: middle; ">{$vo.specs}</td>
                                                <td style="text-align: center; vertical-align: middle; ">{$vo.stock}</td>
                                                <td style="text-align: center; vertical-align: middle; ">{$vo.xstock}</td>
                                                <td style="text-align: center; vertical-align: middle; " class="">
                                                    <input type="number" style="display: none" class="requisition_num" name="row[{$vo.id}][goods_num]" value="{$vo.goods_num}">
                                                    <span class=" ">{$vo.goods_num}</span>
                                                </td>
                                                <td style="text-align: center; vertical-align: middle; ">个</td>
                                                <td style="text-align: center; vertical-align: middle; " class="">
                                                    <input type="text" class="form-control" style="display: none" value="{$vo.sale_price}" name="row[{$vo.id}][sale_price]" onkeyup="checkInputIntFloat(this);">
                                                    <span class="price ">{$vo.sale_price}</span>
                                                </td>
                                                <td style="text-align: center; vertical-align: middle; " class="allprice">0</td>
                                                <td style="text-align: center; vertical-align: middle; " class="">
                                                    <input type="text" class="form-control" style="display: none" value="{$vo.tax}" name="row[{$vo.id}][tax]" onkeyup="checkTaxFloat(this);">
                                                    <span class="tax">{$vo.tax}</span>
                                                </td>

                                                <td style="text-align: center; vertical-align: middle; " class="">
                                                    <input type="text" class="form-control ht_prices" style="display: none" value="{$vo.ht_price}" name="row[{$vo.id}][ht_price]">
                                                    <span class="ht_price">{$vo.ht_price}</span>
                                                </td>
                                                {if condition="$is_finance == 1"}
                                                <td style="text-align: center; vertical-align: middle; " class="">{$vo.costPrice}</td>
                                                {else /}
                                                {/if}
                                                <td style="text-align: center; vertical-align: middle; " class="taxall">0.00</td>
                                                <td style="text-align: center; vertical-align: middle; " class="sfhj">{$vo.sfhj}</td>
                                                <td style="text-align: center; vertical-align: middle; min-width: 100px;
                                                        white-space: nowrap;
                                                        text-overflow:ellipsis;
                                                        overflow:hidden;
                                                        max-width: 120px" class="remark">
                                                    <input type="text" class="form-control" style="display: none" value="{$vo.remark}" name="row[{$vo.id}][remark]">
                                                    <span class="tremark ">{$vo.remark}</span>
                                                </td>
                                            </tr>
                                    {else /}
                                    {/if}
                                    {/volist}

                                </tbody>

                                <tbody class="tbfoot" data-listidx="0" style="display: ">
                                    <td style="text-align: center; vertical-align: middle; ">合计</td>
<!--                                    <td style="text-align: center; vertical-align: middle; "></td>-->
                                    <td style="text-align: center; vertical-align: middle; "></td>
                                    <td style="text-align: center; vertical-align: middle; "></td>
                                    <td style="text-align: center; vertical-align: middle; "></td>
                                    <td style="text-align: center; vertical-align: middle; " class="zstock"></td>
                                    <td style="text-align: center; vertical-align: middle; " class="xstock"></td>
                                    <td style="text-align: center; vertical-align: middle; " class="allnum">0</td>
                                    <td style="text-align: center; vertical-align: middle; "></td>
                                    <td style="text-align: center; vertical-align: middle; " ></td>
                                    <td style="text-align: center; vertical-align: middle; "class="alprice">0</td>
                                    <td style="text-align: center; vertical-align: middle; "></td>
                                    <td style="text-align: center; vertical-align: middle; "></td>
                                    {if condition="$is_finance == 1"}
                                    <td style="text-align: center; vertical-align: middle; "></td>
                                    {else /}
                                    {/if}
                                    <td style="text-align: center; vertical-align: middle; "class="alltax">0</td>
                                    <td style="text-align: center; vertical-align: middle; "class="price_tax">0</td>
                                    <td style="text-align: center; vertical-align: middle; "></td>
                                </tbody>
                            </table>
                        </div>
                      </div>
                <div class="columns-right pull-right" style="margin-top:10px;margin-bottom:10px;"></div>
                                            <table id="table1" class="table table-striped table-bordered table-hover table-nowrap"  data-operate-edit="1" data-operate-del="1" width="100%">
                                                <thead>
                                                <tr>
                                                    <th style="text-align: center; vertical-align: middle; " data-field="id"><div class="th-inner ">Id</div></th>
                                                    <th style="text-align: center; vertical-align: middle; " ><div class="th-inner ">商品编号</div></th>
                                                    <th style="text-align: center; vertical-align: middle; " data-field="number"><div class="th-inner ">商品名称</div></th>
<!--                                                    <th style="text-align: center; vertical-align: middle; " data-field="status"><div class="th-inner ">产地</div></th>-->
                                                    <th style="text-align: center; vertical-align: middle; " data-field="supplier_id"><div class="th-inner ">规格</div></th>
                                                    <th style="text-align: center; vertical-align: middle; " data-field="operator"><div class="th-inner ">账面库存</div></th>
                                                    <th style="text-align: center; vertical-align: middle; " data-field="company"><div class="th-inner ">虚拟库存</div></th>
                                                    <th style="text-align: center; vertical-align: middle; " data-field="order_goods_total"><div class="th-inner ">换货数量</div><div class="fht-cell"></div></th>
                                                    <th style="text-align: center; vertical-align: middle; " data-field="arrival_total"><div class="th-inner ">销售单位</div><div class="fht-cell"></div></th>
                                                    <th style="text-align: center; vertical-align: middle; " data-field="order_price"><div class="th-inner ">销售单价</div><div class="fht-cell"></div></th>
                                                    <th style="text-align: center; vertical-align: middle; " data-field="order_price"><div class="th-inner ">销售金额</div><div class="fht-cell"></div></th>
                                                    <th style="text-align: center; vertical-align: middle; " data-field="arrival_price"><div class="th-inner ">税点</div><div class="fht-cell"></div></th>
                                                    <th style="text-align: center; vertical-align: middle; " data-field="paid_in_price"><div class="th-inner ">含税单价</div><div class="fht-cell"></div></th>
                                                    {if condition="$is_finance == 1"}
                                                    <th style="text-align: center; vertical-align: middle; " ><div class="th-inner ">成本价格</div><div class="fht-cell"></div></th>
                                                    {else /}
                                                    {/if}

                                                    <th style="text-align: center; vertical-align: middle; " data-field="paid_in_price"><div class="th-inner ">税额</div><div class="fht-cell"></div></th>
                                                    <th style="text-align: center; vertical-align: middle; " data-field="explain"><div class="th-inner ">合计</div><div class="fht-cell"></div></th>
                                                    <th style="text-align: center; vertical-align: middle; " data-field="operate"><div class="th-inner ">备注</div><div class="fht-cell"></div></th>
                                                </tr>
                                                </thead>
                                                <tbody data-listidx="0" class="connnn1">
                                                {volist name="list" id="vo"}
                                                {if condition="$vo['goods_type'] == 2"}
                                                    <tr data-index="0">
                                                        <td style="text-align: center; vertical-align: middle; ">
                                                            <input name="row[{$vo.id}][goods_id]" value="{$vo.id}" style="display: none" class="gid gids{$vo.id}">{$vo.id}</td>
                                                        <td style="text-align: center; vertical-align: middle; ">{$vo.number}</td>
                                                        <td style="text-align: center; vertical-align: middle; " class="title">{$vo.title}</td>
<!--                                                        <td style="text-align: center; vertical-align: middle; ">{$vo.place_origin}</td>-->
                                                        <td style="text-align: center; vertical-align: middle; ">{$vo.specs}</td>
                                                        <td style="text-align: center; vertical-align: middle; ">{$vo.stock}</td>
                                                        <td style="text-align: center; vertical-align: middle; ">{$vo.xstock}</td>
                                                        <td style="text-align: center; vertical-align: middle; " class="">
                                                            <input type="number" style="display: none" class="requisition_num" name="row[{$vo.id}][goods_num]" value="{$vo.goods_num}">
                                                            <span class=" ">{$vo.goods_num}</span>
                                                        </td>
                                                        <td style="text-align: center; vertical-align: middle; ">个</td>
                                                        <td style="text-align: center; vertical-align: middle; " class="">
                                                            <input type="text" class="form-control" style="display: none" value="{$vo.sale_price}" name="row[{$vo.id}][sale_price]" onkeyup="checkInputIntFloat(this);">
                                                            <span class="price ">{$vo.sale_price}</span>
                                                        </td>
                                                        <td style="text-align: center; vertical-align: middle; " class="allprice">0</td>
                                                        <td style="text-align: center; vertical-align: middle; " class="">
                                                            <input type="text" class="form-control" style="display: none" value="{$vo.tax}" name="row[{$vo.id}][tax]" onkeyup="checkTaxFloat(this);">
                                                            <span class="tax">{$vo.tax}</span>
                                                        </td>

                                                        <td style="text-align: center; vertical-align: middle; " class="">
                                                            <input type="text" class="form-control ht_prices" style="display: none" value="{$vo.ht_price}" name="row[{$vo.id}][ht_price]">
                                                            <span class="ht_price">{$vo.ht_price}</span>
                                                        </td>
                                                        {if condition="$is_finance == 1"}
                                                        <td style="text-align: center; vertical-align: middle; " class="">{$vo.costPrice}</td>
                                                        {else /}
                                                        {/if}

                                                        <td style="text-align: center; vertical-align: middle; " class="taxall">0.00</td>
                                                        <td style="text-align: center; vertical-align: middle; " class="sfhj">{$vo.sfhj}</td>
                                                        <td style="text-align: center; vertical-align: middle; min-width: 100px;
                                                        white-space: nowrap;
                                                        text-overflow:ellipsis;
                                                        overflow:hidden;
                                                        max-width: 120px" class="remark" >
                                                            <input type="text" class="form-control" style="display: none" value="" name="row[{$vo.id}][remark]">
                                                            <span class="tremark ">{$vo.remark}</span>
                                                        </td>
                                                    </tr>
                                                {else /}
                                                {/if}
                                                {/volist}
                                                </tbody>
                                                <tbody class="tbfoot1" data-listidx="0" style="display: none">
                                                    <td style="text-align: center; vertical-align: middle; ">合计</td>
                                                    <td style="text-align: center; vertical-align: middle; "></td>
<!--                                                    <td style="text-align: center; vertical-align: middle; "></td>-->
                                                    <td style="text-align: center; vertical-align: middle; "></td>
                                                    <td style="text-align: center; vertical-align: middle; "></td>
                                                    <td style="text-align: center; vertical-align: middle; " class="zstock1"></td>
                                                    <td style="text-align: center; vertical-align: middle; " class="xstock1"></td>
                                                    <td style="text-align: center; vertical-align: middle; " class="allnum1">0</td>
                                                    <td style="text-align: center; vertical-align: middle; "></td>
                                                    <td style="text-align: center; vertical-align: middle; " ></td>
                                                    <td style="text-align: center; vertical-align: middle; "class="alprice1">0</td>
                                                    <td style="text-align: center; vertical-align: middle; "></td>
                                                    <td style="text-align: center; vertical-align: middle; "></td>
                                                    {if condition="$is_finance == 1"}
                                                    <td style="text-align: center; vertical-align: middle; "></td>
                                                    {else /}
                                                    {/if}
                                                    <td style="text-align: center; vertical-align: middle; "class="alltax1">0</td>
                                                    <td style="text-align: center; vertical-align: middle; "class="price_tax1">0</td>
                                                    <td style="text-align: center; vertical-align: middle; "></td>
                                                </tbody>
                                            </table>
                                        </div>
                    </div>
                    <br>
                    <div class="widget-body no-padding">

                        <div class="bootstrap-table">
                            <div class="commonsearch-table ">
                                <fieldset>
                                    <div class="row">
                                        <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">
                                            <label for="company" class="control-label col-xs-4">优惠</label>
                                            <div class="col-xs-8">
                                                <input type="text" class="form-control " name="discount" value="{$row.discount}" placeholder="优惠" id="discount1" data-index="7" onkeyup="upperCase(this);" disabled>
                                            </div>
                                        </div>
                                        <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">
                                            <label for="c-storehouse_id" class="control-label col-xs-4">优惠说明</label>
                                            <div class="col-xs-8">
                                                <input id="c-discount-explain1"   class="form-control " name="discount_explain" type="text" value="{$row.discount_explain}" disabled>
                                            </div>
                                        </div>
                                        <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">
                                            <label for="c-storehouse_id" class="control-label col-xs-4">差价</label>
                                            <div class="col-xs-8">
                                                <input id="c-actual-cost" data-rule="required"  class="form-control actual_cost1" name="actual-cost" type="text" value="{$row.actual_cost}" disabled>
                                                <input  data-rule="required"  class="form-control actual_cost1" name="actual_cost" type="text" value="{$row.actual_cost}" style="display: none">
                                            </div>
                                        </div>
                                    </div>
                                </fieldset>
                            </div>
                        </div>
                    </div>

                    <div class="widget-body no-padding">
                        <label for="explain" class="control-label col-xs-1">退货声明(必填):</label>
                        <div class="col-xs-11">
                            <textarea type="text" data-rule="required" class="form-control"   name="declare" rows="5" disabled>{$row.declare}</textarea>
                        </div>
                    </div>

              </div>
    {if condition="$auth->check('sales/slip/examine') && $row.status == 1 "}
        <input type="hidden" name="status" value="1">
        <div class="form-group layer-footer">
            <label class="control-label col-xs-12 col-sm-2"></label>
            <div class="col-xs-12 col-sm-8">
                <button type="submit" class="btn btn-success btn-embossed subpurchase">{:__('OK')}</button>
                <button type="submit" class="btn btn-default btn-embossed reset">驳回</button>
            </div>
        </div>
    {else /}

    {/if}
</form>
<div class="form-group layer-footer">
    <div class="col-xs-12 col-sm-2">
        <button type="submit" class="btn btn-error btn-embossed joint-search" data-id="{$row.sales_checkout_id}">{:__('销售单联查')}</button>
    </div>
    {if condition="$row['status'] > 1 && $row['status'] < 7 "}
    <div class="col-xs-12 col-sm-3">
        <button type="submit" class="btn btn-danger btn-embossed cancelbill {:$auth->check('sales/change/cancelbill')?'':'hide'}">{:__('单据红冲')}</button>
    </div>
    {else /}
    {/if}
</div>



<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.js"></script>
<script>
    var is_edit = 1
    $('body').on('mouseenter','.remark',function () {
        if (this.offsetWidth < this.scrollWidth) {
            var that = this;
            var text = $(this).text();
            layer.tips(text, that,{
                tips: 1,
                time: 2000         //设置显示时间
            });
        }
    })

    $('.joint-search').click(function () {
        var url = Config.this_url+'/sales/checkout/detail?ids='+$(this).data('id')
        // console.log(url)
        Backend.api.addtabs(url, '出库单单详情', 'fa fa-circle-o fa-fw');
    })
    var ischeck = 0;
    $('.subpurchase').click(function () {
        $("input[name='status']").val(2)

        if(ischeck == 0){
            layer.confirm('是否确认阅读退货声明?', function(index){
                layer.close(index);
                ischeck = 1
                $('.subpurchase').click()
            });
            return  false
        }
    })
    $('.reset').click(function () {
        $("input[name='status']").val(7)
    })
</script>

{include file='common/footer' /}
{include file='common/footer1' /}
{include file='common/adapt' /}
<script>
    $('#abstract').val()
    $('.price_tax').html()
    $('.price_tax1').html()
</script>